#pragma once
#include "HashTable.h"

template<class K>
struct KOfT_Set
{
    const K& operator()(const K& key) const
    {
        return key;
    }
};

template<class K>
class unordered_set
{
public:
    typedef typename HashTable<K, const K, KOfT_Set<K>, HashFunc<K>>::Iterator iterator;
    typedef typename HashTable<K, const K, KOfT_Set<K>, HashFunc<K>>::ConstIterator const_iterator;

    iterator begin()
    {
        return _ht.Begin();
    }
    iterator end()
    {
        return _ht.End();
    }

    const_iterator begin() const
    {
        return _ht.Begin();
    }
    const_iterator end() const
    {
        return _ht.End();
    }

    bool insert(const K& key)
    {
        return _ht.Insert(key).second;
    }
    bool erase(const K& key)
    {
        return _ht.Erase(key);
    }
    iterator find(const K& key)
    {
        return _ht.Find(key);
    }

private:
    HashTable<K, const K, KOfT_Set<K>, HashFunc<K>> _ht;
};
